#define _CRT_SECURE_NO_WARNINGS 1
#include <vector>
using namespace std;
class Solution {
public:
    vector<int> getRow(int rowIndex)
    {
        vector<int> v(1, 1);
        if (rowIndex == 0) return v;
        for (int i = 0;i < rowIndex;++i)
        {
            int vsize = v.size();
            vector<int> tmp = v;
            v.resize(vsize + 1);
            for (int j = 0;j < v.size();++j)
            {
                int val = 0;
                if (j - 1 >= 0)
                {
                    val += tmp[j - 1];
                }
                if (j < tmp.size())
                {
                    val += tmp[j];
                }
                v[j] = val;
            }
        }
        return v;
    }
};